<template>
	<view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler">
		<view class="my-search-box" :style="{'border-radius':radius+'px'}">
			<!-- 使用 uni-ui 提供的图标组件-->
			<uni-icons type="search" size="25" style="margin-left: 5px;"></uni-icons>
			<button class="placeholder">搜索</button>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			// 背景颜色
			bgcolor: {
				type: String,
				// default: "#f4f4f4"
			},
			// 圆角尺寸
			radius: {
				type: Number,
				default: 18 // px
			}
		},
		data() {
			return {

			};
		},
		methods: {
			searchBoxHandler() {
				this.$emit('click')
			}
		}
	}
</script>

<style lang="scss">
	.my-search-container {
		width: 90%;
		height: 80rpx;
		// background-color: #c00000;
		display: flex;
		align-items: center;
		margin: auto;
		// padding: 0 10px;

		.my-search-box {
			width: 100%;
			height: 36px;
			background-color: #f4f4f4;
			// border-radius: 18px;
			display: flex;
			justify-content: space-between;
			align-items: center;


			.placeholder {
				font-size: 13px;
				margin-right: 5px;
				// width: 30px;
				height: 25px;
				display: flex;
				align-items: center;
				background-color: #cfcdff;
				border: #cfcdff 1px;
				border-radius: 20px;
			}
		}
	}
</style>